Use the Load Variables
statement, which is one of the parameters of Load Movie
, to read data from a text file or text generated by a CGI script, and set the values for variables in a movie or movie clip. For example, if a user submits an order form, you might want a confirmation screen to display an order number gathered from a file on a remote server.
With Load Variables
, the text at the URL must be in the standard MIME format application/x-www-urlformencoded (a standard format used by CGI scripts). Any number of variables can be specified. For example, this phrase defines several variables:
company=Macromedia&address=600+Townsend&city=San+Francisco&zip=94103
![]() |
URL specifies an absolute or relative URL for the remote file. |
![]() |
Location specifies a level or target to receive the variables. In the Flash Player, movie files are assigned a number according to the order in which they were loaded. The movie that was loaded first is loaded at the bottom level, level 0. The movie in level 0 sets the frame rate, background color, and frame size for all other loaded movies. Movies are then stacked in higher numbered levels above the movie in level 0. |
For more information about levels and targets, see Understanding multiple Timelines. | |
![]() |
Variables determines whether to use GET or POST to pass variables, or to pass no variables at all. This can be used to send variables to a CGI script that generates a SWF file as its CGI output. The GET method appends the variables to the end of the URL, and is used when a small number of variables are involved. The POST method sends the variables in a separate header, and is capable of sending much longer strings. See Setting and identifying variables. |
If you specify either GET or POST with the Load Variables statement, Flash sends the variables to the web server, and then interprets the server's response to update the variables in the movie. |
Use the File > Publish Preview option to test the loading of variables. (An active network connection must exist for this to work.)